using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace Musicman.Entities.BusinessEntities
{
    public class SearchLoactionConfigurationElementCollection : ConfigurationElementCollection
    {

        public SearchLoactionConfigurationElementCollection()
        {
            SearchLoacationConfigurationElement location = (SearchLoacationConfigurationElement)CreateNewElement();
            Add(location);

        }

        public override ConfigurationElementCollectionType CollectionType
        {
            get
            {
                return ConfigurationElementCollectionType.AddRemoveClearMap;
            }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new SearchLoacationConfigurationElement();
        }

        protected override Object GetElementKey(ConfigurationElement element)
        {
            return ((SearchLoacationConfigurationElement)element).ServerPath;
        }

        public void Add(SearchLoacationConfigurationElement location)
        {
            BaseAdd(location);
        }

        public new string AddElementName
        {
            get
            { return base.AddElementName; }

            set
            { base.AddElementName = value; }

        }

        public new string ClearElementName
        {
            get
            { return base.ClearElementName; }

            set
            { base.AddElementName = value; }

        }

        public new string RemoveElementName
        {
            get
            { return base.RemoveElementName; }
        }

        public new int Count
        {
            get { return base.Count; }
        }

        public SearchLoacationConfigurationElement this[int index]
        {
            get
            {
                return (SearchLoacationConfigurationElement)BaseGet(index);
            }
            set
            {
                if (BaseGet(index) != null)
                {
                    BaseRemoveAt(index);
                }
                BaseAdd(index, value);
            }
        }

        new public SearchLoacationConfigurationElement this[string Name]
        {
            get
            {
                return (SearchLoacationConfigurationElement)BaseGet(Name);
            }
        }

        public int IndexOf(SearchLoacationConfigurationElement location)
        {
            return BaseIndexOf(location);
        }

        protected override void BaseAdd(ConfigurationElement element)
        {
            BaseAdd(element, false);
        }

        public void Remove(SearchLoacationConfigurationElement location)
        {
            if (BaseIndexOf(location) >= 0)
            {
                BaseRemove(location.ServerPath);
            }
        }

        public void RemoveAt(int index)
        {
            BaseRemoveAt(index);
        }

        public void Remove(string name)
        {
            BaseRemove(name);
        }

        public void Clear()
        {
            BaseClear();
        }


    }
}
